<?php

defined('BASEPATH') OR exit('No direct script access allowed');

class Payment_model extends CI_Model {

    
    function create($update_data) {
        
        $create_data['created_at'] = time();
        $this->db->insert('payments', $update_data);

        return $this->db->insert_id();
    }

    function edit($id, $edit_data) {
        return $this->db->where('payment_id', $id)->update('payments', $edit_data);
    }
    
    function active_status($id, $status) {
        if ($status == '1') {
            $st = '0';
        } else {
            $st = '1';
        }
        return $this->db->where('payment_id', $id)
                        ->update('payments', array('is_active' => $st));
    }
    
            
    function get($id) {
        return $this->db->select('*')->where('payment_id', $id)
                        ->get('payments')->row_array();
    }
    
    function delete($id){
        $this->db->delete('payments', array('payment_id' => $id));
        return TRUE;
    }
}
